import React from "react";
import { BrowserRouter as Router, Route, Redirect } from "react-router-dom";

// 模块
import Main from "@views/main";
import About from "@views/about";
import News from "@views/news";
import NewsDetails from "@views/news/details";

function router() {
  return (
    <Router>
      <Route exact path="/main" render={() => <Redirect to="/" />} />
      <Route exact path="/" component={Main} />
      <Route exact path="/about" component={About} />
      <Route
        path="/news"
        render={() => (
          <News>
            <Route path="/news/news-details" component={NewsDetails} />
          </News>
        )}
      />
      {/* <Route exact path="/news" component={ News }/>
      <Route exact path="/news-etails" component={ NewsDetails }/> */}
    </Router>
  );
}
export default router;
